﻿<?php
require_once('../../../config.php');
 require_once($CFG->libdir . '/adminlib.php');
 require_once($CFG->dirroot . '/local/myplugin/lib.php');
 require_once($CFG->dirroot.'/course/lib.php');
 
require_once($CFG->dirroot . "/local/myplugin/forms.php");

global $DB;
$option=array();
$path = $CFG->wwwroot.'/local/myplugin/curriculum/test_generate_course.php';

/* Ket noi den file javascript - module.js */

$cssdir =  $CFG->wwwroot.'/local/myplugin/css/mycss.css';
echo '<link rel="stylesheet" href="'.$cssdir.'" type="text/css" media="screen" />';
echo '<script src="../module.js"></script>';

//==================start colorbox=================
echo '<script src="../colorbox/jquery.min.js"></script>';
echo '<link rel="stylesheet" href="../css/colorbox.css" />';
echo '<script src="../colorbox/jquery.colorbox.js"></script>';



/* Chuan bi trang web can hien thi */	
$url = new moodle_url($path);
$PAGE->set_url($url);
$PAGE->set_title('Add Academic Program');
$PAGE->set_heading('Add Academic Program');
$PAGE->set_pagelayout('standard');


//Them thanh menu ngang ung voi trang trong duong link
navigation_node::override_active_url(new moodle_url($path, array('param'=>'value')));

echo $OUTPUT->header();

/* Viet doan code cua ban o day */

//add tab vào trang


$mform = new form_course_generation_test();
$mform->display();

//kiem tra neu dc submitted thì làm gì
if ($fromform = $mform->get_data()) 
{
	$subject = $fromform->txtSubjectName;
	
	// $data->category = 1;
	// $data->fullname = $subject;
	// $data->shortname = 'sn02';
	// create_course($data);
	$category->name = $fromform->txtSubjectName;
	$category->description = $fromform->txtSubjectName;
	$DB->insert_record('course_categories', $category);
	
}
	

/*------Ket thuc doan code cua ban-------*/

echo $OUTPUT->footer();


